﻿<html DIR="LTR" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ddue="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
  <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8" />
    <META NAME="save" CONTENT="history" />
    <title>Readme_Service Broker Ordering Service Sample</title>
    
    
    
    <style TYPE="text/css">
body
{
background: #FFFFFF;
color: #000000;
font-family:    Verdana;
font-size: medium;
font-style: normal;
font-weight: normal;
margin-top: 0;
margin-bottom:  0;
margin-left:    0;
margin-right:   0;
width:  100%;
}

div.#mainSection
{
font-size: 70%;
width: 100%;
padding-left:    10;
margin-right: 10;
}

div.#mainBody
{
font-size: 90%;
margin-top: 10;
padding-bottom: 20;
}

div.#header
{
background-color: #D2D2D2;
padding-top:    0;
padding-bottom: 0;
padding-left:   10;
padding-right:  0;
width:          100%;
}

div.#header table
{
border-bottom-color: #C8CDDE;
border-bottom-style: solid;
border-bottom-width: 1;
width:  100%;
}

span.#runningHeaderText
{
color: #003399;
font-size: 90%;
}

span.#nsrTitle
{
/*    color: #003399;*/
font-size: 120%;
font-weight: 600;
}

div.#header table td
{
color: #000000;
font-size: 70%;
margin-top: 0;
margin-bottom:  0;
padding-right: 20;
}

div.#header table tr.#headerTableRow3 td
{
padding-bottom: 2;
padding-top: 5;
}

div.#header table.#bottomTable
{
border-top-color: #FFFFFF;
border-top-style: solid;
border-top-width: 1;
text-align: left;
}

div.#footer
{
font-size: 90%;
margin-top: 0;
margin-bottom:  0;
margin-left:    -5;
margin-right:   0;
padding-top:    2;
padding-bottom: 2;
padding-left:   0;
padding-right:  0;
width:  100%;
}

hr.#footerHR
{
border-bottom-color: #EEEEFF;
border-bottom-style: solid;
border-bottom-width: 1;
border-top-color: C8CDDE;
border-top-style: solid;
border-top-width: 1;
height: 3;
color: #D2D2D2;
}

div.section
{
padding-top:    2;
padding-bottom: 2;
padding-right:  15;
width:  100%;
}

.heading
{
color:          #000000;
font-weight:    bold;
margin-top:     18;
margin-bottom:  8;
}

h1.heading
{
color: #000000;
font-size:  150%;
}

.subHeading
{
color:          #000000;
font-weight:    bold;
font-size:      150%;
margin-bottom:  4;
}

h2.subHeading
{
color:          #000000;
font-weight:    bold;
font-size:      130%;
}
h3.subHeading
{
color:  #000000;
font-size: 125%;
font-weight: bold;
}

h4.subHeading
{
color: #000000;
font-size: 110%;
font-weight: bold;
}

h4.procedureHeading
{
color: #000080;
font-size: 110%;
font-weight: bold;
}

h5.subHeading
{
color: #000000;
font-size: 100%;
font-weight: bold;
}

img
{
padding-bottom: 10;
}

img.toggle
{
border: 0;
margin-right: 5;
padding-bottom: 10;
}

img.copyCodeImage
{
border: 0;
margin: 1;
margin-right: 3;
padding-bottom: 10;
}

img.downloadCodeImage
{
border: 0;
margin-right: 3;
padding-bottom: 10;
}

img.viewCodeImage
{
border: 0;
margin-right: 3;
padding-bottom: 10;
}

img.note
{
border: 0;
margin-right: 3;
padding-bottom: 10;
}

img.#membersOptionsFilterImage
{
border: 0;
margin-left: 10;
vertical-align: middle;
padding-bottom: 10;
}

img.#toggleAllImage
{
margin-left: 4;
vertical-align: middle;
padding-bottom: 10;
}

div.#mainSection table
{
border: 0;
font-size: 100%;
width:  100%;
margin-top: 5px;
margin-bottom: 15px;
}

div.#mainSection table tr
{
vertical-align: top;
}

div.#mainSection table th
{
text-align: left;
background: #D8D8D8;
border-bottom-color: #D8D8D8;
border-bottom-style: solid;
border-bottom-width: 1;
color: #000000;
padding-left: 5;
padding-right: 5;
}

div.#mainSection table td
{
background: #F2F2F2;
border-top-color: #D8D8D8;
border-top-style: solid;
border-top-width: 1;
padding-left: 5;
padding-right: 5;
}

div.#mainSection table td.imageCell
{
white-space: nowrap;
}

div.code
{
width: 98%;
}

div.code table
{
border: 0;
font-size: 95%;
margin-bottom: 5;
width: 100%
}

div.code table th
{
text-align: left;
background: #D8D8D8;
border-bottom-color: #D8D8D8;
border-bottom-style: solid;
border-bottom-width: 1;
color: #000000;
font-weight: bold;
padding-left: 5;
padding-right: 5;
}

div.code table td
{
background: #CCCCCC;
border-top-color: #D8D8D8;
border-top-style: solid;
border-top-width: 1;
padding-left: 5;
padding-right: 5;
padding-top: 5;
}

div.alert
{
margin-left: 10;
width: 98%;
}

div.alert table
{
border: 1;
font-size: 100%;
width:  100%;
border: solid 1 #DEDFEF;
}

div.alert table th
{
text-align: left;
background: #D8D8D8;
border-bottom-width: 0;
color: #000000;
padding-left: 5;
padding-right: 5;
border: solid 1 #DEDFEF;
}

div.alert table td
{
background: #FFFFFF;
border-top-color: #D8D8D8;
border-top-style: solid;
border-top-width: 1;
padding-left: 5;
padding-right: 5;
border: solid 1 #DEDFEF;
}

span.copyCode
{
color: #0000ff;
font-size: 90%;
font-weight: normal;
cursor: hand;
float: right;
display: inline;
text-align: right;
}

.downloadCode
{
color: #0000ff;
font-size: 90%;
font-weight: normal;
cursor: hand;
}

.viewCode
{
color: #0000ff;
font-size: 90%;
font-weight: normal;
cursor: hand;
}

div.code pre
{
font-family:    Monospace, Courier New, Courier;
font-size: 105%;
color:  #000000;
}

code
{
font-family:    Monospace, Courier New, Courier;
font-size: 105%;
color:  #000000;
}

dl
{
margin-top: 0;
padding-left:   1;
}

dd
{
margin-bottom:  0;
margin-left:    0;
padding-left:   20;
}

dd p
{
margin-top: 5;
}

ul
{
margin-left: 17;
list-style-type: disc;
}

ul ul
{
margin-bottom: 4;
margin-left: 17;
margin-top: 3;
list-style-type: disc;
}

ol
{
margin-left: 24;
list-style-type: decimal;
}

ol ol
{
margin-left: 24;
margin-top: 3;
list-style-type: lower-alpha;
}

li
{
margin-top: 0;
margin-bottom: 0;
padding-bottom: 0;
padding-top: 0;
margin-left: 5;
}

p
{
margin-bottom: 15;
}

.tip
{
color:  #0000FF;
font-style: italic;
cursor:hand;
text-decoration:underline;
}

.math
{
font-family: Times New Roman;
font-size: 125%
}
.sourceCodeList
{
font-family: Verdana;
font-size: 90%;
}

pre.viewCode
{
width: 100%;
overflow: auto;
}

li:hover table, li.over table
{
background-color: #C0C0C0;
}

li:hover ul, li.over ul
{
background-color: #d2d2d2;
border: 1px solid #000;
display: block;
}
            </style>
  </head>
  <body>
    <!--Topic built:02/12/2008 21:30:29-->

    
    
    
    
    
    
    
    
    
    <div id="header">
      <table width="100%" id="topTable"><tr>
          <td align="left">
            <span id="nsrTitle">Readme_Service Broker Ordering Service Sample</span>
          </td>
          <td align="right">
            <span id="headfb" class="feedbackhead">
            </span>
          </td>
        </tr></table>
      
      
      
    </div>
    <div id="mainSection">
      <div id="mainBody"><p> 2/12/2008 9:30:29 PM</p>
        
        <font color="DarkGray">[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.] </font><p /> 
        <span id="changeHistory">
        </span>
    <p>
      This sample works only with SQL Server 2005 and SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2005.
    </p>
    <p>The Adventure Works Storefront sample accepts an online order and returns a predefined ship date in the order status screen. This sample adds backend order processing capabilities to Adventure Works Storefront.</p>
    <p>This sample illustrates the fundamental concepts of Service Broker and allows you to view the Transact-SQL scripts used to run the sample, and the results of executing that script in the Service Broker tables.</p>
    <div class="alert"><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Note: </th></tr><tr><td>
      This sample requires the Adventure Works Storefront sample. For more information about installing the Storefront sample, see <a href="html/a136f993-93a1-4b9a-955f-93fda9069ed9.htm">Readme_Storefront</a>.<p />
    </td></tr></table><p /></div>
  <h1 class="heading">Scenario</h1><div id="sectionSection0" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">A developer wants to implement a backend order processing system for an e-commerce Web site.</p>
    </content></div><h1 class="heading">Languages</h1><div id="sectionSection1" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">
        Transact-SQL, XML, XSD, and Visual C#.</p>
    </content></div><h1 class="heading">Prerequisites</h1><div id="sectionSection2" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">Before running this sample, make sure the following software is installed:</p>
      <ul xmlns=""><li>
          
            SQL Server, including the following components:<br />
          <ul><li>
              
                SQL Server Database Engine <br />
            </li><li>
              
                SQL Server Management Studio <br />
            </li><li>
              
                <b>AdventureWorks</b> sample database<br />
            </li><li>
              
                Database Engine Samples<br />
            </li><li>
              
                Adventure Works Storefront sample<br />
            </li><li>
              
                .NET Framework SDK 2.0 or Microsoft Visual Studio 2005. You can obtain .NET Framework SDK free of charge. See <b>Installing the .NET Framework SDK</b>.<br />
            </li></ul>
        </li></ul>
    </content></div><h1 class="heading">Building the Sample</h1><div id="sectionSection3" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">The C# source code is built with the Storefront sample. To create the SQL Server portion of the sample, follow the steps below.</p>
      <p xmlns="">All Service Broker applications are composed of a collection of SQL Server objects that provide the service functionality. In this step, you will create the Service Broker environment, consisting of the XML schema collections, message types, contracts, queues, and services required to operate it.</p>
      <h4 class="procedureHeading" xmlns="">Set up the Service Broker environment</h4><div id="procedureSectionEBBFBHA" class="section" xmlns=""><ol><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Run the Transact-SQL script to set up Service Broker. You can run <b>installorderingservice.cmd</b>, or you can run the individual scripts.</p>
              <ol xmlns=""><li>
                  Run <b>installorderingservice.cmd</b>. The default folder is C:\Program Files\Microsoft SQL Server\100\Samples\Integrated Samples\Storefront.<br />
                </li><li>
                  Alternatively, you can run the individual scripts in the following order:<br />
                </li></ol>
              <ul xmlns=""><li>
                  
                    <b>OrderingServiceScripts\Setup.sql</b>
                  <br />
                </li><li>
                  
                    <b>OrderingServiceScripts\SetupOrderingServiceProgram.sql</b>
                  <br />
                </li><li>
                  
                    <b>OrderingServiceScripts\SetupPurchasingServiceProgram.sql</b>
                  <br />
                </li><li>
                  
                    <b>OrderingServiceScripts\SetupManufacturingServiceProgram.sql</b>
                  <br />
                </li><li>
                  
                    <b>OrderingServiceScripts\SetupShippingServiceProgram.sql</b>
                  <br />
                </li></ul>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Configure the Storefront.</p>
              <ol xmlns=""><li>
                  Edit the <b>web.config</b> file, located in the directory C:\Program Files\Microsoft SQL Server\100\Samples\Integrated Samples\Storefront\CS\StoreCSVS. Find the <b>ExtendedOrderProcessing</b> attribute, and change the value to <b>true</b>. After making the change, this element should look like the element below:<br />
                  
                    <code>&lt;add key="ExtendedOrderProcessing" value="true"/&gt;</code>
                  <br />
                </li></ol>
            </content>
          </li></ol></div>
    </content></div><h1 class="heading">Running the Sample</h1><div id="sectionSection4" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">In this exercise, you will go to the Adventure Works Web site and order an in-stock item. Because the item is in stock, the Ordering Service sends a Shipping Request message to the Shipping Service, and the Shipping Service responds back to the Ordering Service with a Shipping Accept message. Follow the steps in this exercise to see this process in SQL Server Management Studio.</p>
      <h4 class="procedureHeading" xmlns="">Order an in-stock item</h4><div id="procedureSectionEHBDBHA" class="section" xmlns=""><ol><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">In Internet Explorer, open <b>http://localhost/storeCSVS/</b> .</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">In the left pane, expand <b>Accessories</b>, and then expand <b>Helmets</b>. Select <b>Sports-100 Helmet, Red</b>, and then click <b>Add to Cart</b>. On the <b>Shopping Cart</b> page, click <b>Final Check Out</b>. On the next page, click <b>Submit</b>.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">In SQL Server Management Studio, run <b>AdministrationAndTroubleShooting.sql</b>. The default folder is C:\Program Files\Microsoft SQL Server\100\Samples\Integrated Samples\Storefront\OrderingServiceScripts. The result shows the processing flow, including Server Broker queue tables, ordering state, and audit logs.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Run <b>purge.sql</b> to clean up contents in queues and tables before continuing on to the next exercise.</p>
            </content>
          </li></ol></div>
      <h4 class="procedureHeading" xmlns="">Order an out-of-stock buy item</h4><div id="procedureSectionEFBDBHA" class="section" xmlns=""><ol><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">In Internet Explorer, open <b>http://localhost/storeCSVS/</b> .</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">In the left menu, expand <b>Clothing</b>.  Click the submenu item <b>Tights</b>. Pick <b>Women’s Tights, M</b>, and then click <b>Add to Cart</b>. In the next page, click <b>Final Check Out</b>. In the next page, click <b>Submit</b>.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">In SQL Server Management Studio, run <b>AdministrationAndTroubleShooting.sql</b>. The default folder is C:\Program Files\Microsoft SQL Server\100\Samples\Integrated Samples\Storefront\OrderingServiceScripts. The result shows the processing flow, including Server Broker queue tables, ordering state, and audit logs.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Run <b>purge.sql</b> to clean up contents in queues and tables before continuing on to the next exercise.</p>
            </content>
          </li></ol></div>
      <h4 class="procedureHeading" xmlns="">Order an out-of-stock make item ready for manufacturing</h4><div id="procedureSectionEDBDBHA" class="section" xmlns=""><ol><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">In Internet Explorer, open <b>http://localhost/storeCSVS/</b> .</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">On the left menu, expand <b>Components</b>.  Click <b>Mountain Frames</b>, select <b>HL Mountain Frame – Black, 38</b>, and then click <b>Add to Cart</b>. On the next page, click <b>Final Check Out</b>. On the next page, click <b>Submit</b>.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">In SQL Server Management Studio, run <b>AdministrationAndTroubleShooting.sql</b>. The default folder is C:\Program Files\Microsoft SQL Server\100\Samples\Integrated Samples\Storefront\OrderingServiceScripts. The result shows the processing flow, including Server Broker queue tables, ordering state, and audit logs.</p>
            </content>
          </li><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Run <b>purge.sql</b> to clean up contents in queues and tables before continuing on to the next exercise.</p>
            </content>
          </li></ol></div>
      <h4 class="procedureHeading" xmlns="">Remove the sample</h4><div id="procedureSectionEBBDBHA" class="section" xmlns=""><ol><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Run <b>uninstallorderingservice.cmd</b>. The default folder is C:\Program Files\Microsoft SQL Server\100\Samples\Integrated Samples\Storefront.</p>
            </content>
          </li></ol></div>
    </content></div><!--[if gte IE 5]>
			<tool:tip element="seeAlsoToolTip" avoidmouse="false"/><tool:tip element="languageFilterToolTip" avoidmouse="false"/><tool:tip element="roleInfoSpan" avoidmouse="false"/>
		<![endif]--></div>
      <div id="footer">
			
			© 2008 Microsoft Corporation. All rights reserved.
		</div>
    </div>
  </body>
</html>